package com.hjt.zhibo.tag;

import java.io.IOException;

import javax.servlet.jsp.JspContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.SimpleTagSupport;

import com.hjt.zhibo.model.HotCatalog;
import com.hjt.zhibo.model.WebCatalog;
import com.jfinal.plugin.activerecord.Page;

public class WebCatologTag extends SimpleTagSupport{

	private int count;

	public void doTag() throws JspException, IOException {
		
		JspContext JspContext = this.getJspBody().getJspContext();
		
		Page<WebCatalog> page = WebCatalog.dao.paginate(1, count, "select * ", " from web_catalog ");
		
		 for (WebCatalog hotCatalog : page.getList()) {
			 JspContext.setAttribute("name", hotCatalog.get("name"));
			 JspContext.setAttribute("url", hotCatalog.get("url"));
			 this.getJspBody().invoke(null);
		 }
	}
	
	public void setCount(int count) {
		this.count = count;
	}
	
}
